/**
 * 功能描述
 */
define(function(require, exports, module) {
	// 引入视图基类
	var ELView = require("elview");
	var store = require("store");
	var activeUser = store.get("user");
	var roles = activeUser.roles;
	var enmu = require("enums");

	// assets
	var template = require("./assets/tpl/roomStatus_main.tpl");
	require("./assets/css/roomStatus_main.css");

	// business
	var handler = require("./handler/__Events");
	// component
	var roomStatusSubnavComp = require("./component/roomStatusSubnav");
	var roomStatusGridComp = require("./component/roomStatusGrid");
	var roomStatusFormComp = require("./component/roomStatusForm");


	var roomStatus = require("./store/roomStatus");
	var App = ELView.extend({
		attrs : {
			template : template
		},
		_betch:handler.betch,
		
		initComponent : function(params, widget) {
			if(params.type == "vestibule"){//前厅
				widget.set("type","vestibule");
			}
			roomStatusSubnavComp.initComponent(params, widget);
			roomStatusGridComp.initComponent(params, widget);
			roomStatusFormComp.initComponent(params, widget);
		},
		afterInitComponent : function(params, widget) {
			
			widget.get("subnav").load("buildings",{
                callback: function(data) {
                	widget.get("subnav").load("roomTypes",{
                		callback: function(data) {
                			
                			widget.get("grid").refresh();
                		}
                		
                	});
                }
            });
		}
	});

	module.exports = App;
});
